$OpenBSD: patch-Modules_FindTclsh_cmake,v 1.4 2014/09/11 10:24:38 dcoppa Exp $
--- Modules/FindTclsh.cmake.orig	Thu Jul 31 17:03:56 2014
+++ Modules/FindTclsh.cmake	Wed Sep  3 08:10:09 2014
@@ -29,14 +29,21 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
+set(MODTCL_VERSION $ENV{MODTCL_VERSION})
+set(MODTK_VERSION $ENV{MODTK_VERSION})
+
 if(CYGWIN)
   find_program(TCL_TCLSH NAMES cygtclsh83 cygtclsh80)
 endif()
 
 get_filename_component(TK_WISH_PATH "${TK_WISH}" PATH)
 get_filename_component(TK_WISH_PATH_PARENT "${TK_WISH_PATH}" PATH)
-string(REGEX REPLACE
-  "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
+if(MODTK_VERSION)
+  set(TK_WISH_VERSION "${MODTK_VERSION}")
+else(MODTK_VERSION)
+  string(REGEX REPLACE
+    "^.*wish([0-9]\\.*[0-9]).*$" "\\1" TK_WISH_VERSION "${TK_WISH}")
+endif(MODTK_VERSION)
 
 get_filename_component(TCL_INCLUDE_PATH_PARENT "${TCL_INCLUDE_PATH}" PATH)
 get_filename_component(TK_INCLUDE_PATH_PARENT "${TK_INCLUDE_PATH}" PATH)
@@ -75,16 +82,22 @@ if(WIN32)
     )
 endif()
 
-set(TCL_TCLSH_NAMES
-  tclsh
-  tclsh${TCL_LIBRARY_VERSION} tclsh${TK_LIBRARY_VERSION} tclsh${TK_WISH_VERSION}
-  tclsh86 tclsh8.6
-  tclsh85 tclsh8.5
-  tclsh84 tclsh8.4
-  tclsh83 tclsh8.3
-  tclsh82 tclsh8.2
-  tclsh80 tclsh8.0
-  )
+if(MODTCL_VERSION)
+  set(TCL_TCLSH_NAMES
+    tclsh${MODTCL_VERSION}
+    )
+else(MODTCL_VERSION)
+  set(TCL_TCLSH_NAMES
+    tclsh
+    tclsh${TCL_LIBRARY_VERSION} tclsh${TK_LIBRARY_VERSION} tclsh${TK_WISH_VERSION}
+    tclsh86 tclsh8.6
+    tclsh85 tclsh8.5
+    tclsh84 tclsh8.4
+    tclsh83 tclsh8.3
+    tclsh82 tclsh8.2
+    tclsh80 tclsh8.0
+    )
+endif(MODTCL_VERSION)
 
 find_program(TCL_TCLSH
   NAMES ${TCL_TCLSH_NAMES}
